home *** CD-ROM | disk | FTP | other *** search
- // ObjectWindows - (C) Copyright 1992 by Borland International
-
- #include <owl.h>
- #include <dialog.h>
- #include <edit.h>
- #include "dialtest.h"
- void CreateTable(HWND&);
- BOOL TableHasChanged = True; // not implemented yet
- class TTestDialog : public TDialog
- {
- // edit control will be used to allow user to enter data for table
- // PTEdit editptr;
- public:
- TTestDialog(PTWindowsObject AParent, LPSTR AName)
- : TDialog(AParent, AName)
- {
- // editptr = new TEdit(this, 101, 256 );
- CreateTable((HWND)Parent->HWindow);// pass parent's handle because
- // we're not created yet. The handle
- // is used by MessageBox to display
- // Engine errors
- };
- virtual void Ok(RTMessage Msg)
- = [ID_FIRST + IDOK];
-
- };
- // this function will be used to prompt user for
- // saving changes to the database
- void TTestDialog::Ok( RTMessage Msg )
- {
- // editptr->GetText( InfoBuffer, 256 );
- if( TableHasChanged )
- MessageBox(HWindow, "Save Changes?", "Table has Changed", MB_OKCANCEL);
- TDialog::Ok(Msg);
- }
- class TTestWindow : public TWindow
- {
- public:
- TTestWindow(PTWindowsObject AParent, LPSTR ATitle);
- virtual void CMTest(RTMessage Msg)
- = [CM_FIRST + CM_TEST];
- };
-
- class TTestApp : public TApplication
- {
- public:
- TTestApp(LPSTR AName, HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPSTR lpCmdLine, int nCmdShow) :
- TApplication(AName, hInstance, hPrevInstance, lpCmdLine, nCmdShow) {};
- virtual void InitMainWindow();
- };
-
-
- TTestWindow::TTestWindow(PTWindowsObject AParent, LPSTR ATitle)
- : TWindow(AParent, ATitle)
- {
- AssignMenu("COMMANDS");
- }
-
- void TTestWindow::CMTest(RTMessage)
- {
- GetApplication()->ExecDialog(new TTestDialog(this, "TESTDIALOG"));
- }
-
- void TTestApp::InitMainWindow()
- {
- MainWindow = new TTestWindow(NULL, Name);
- }
-
- int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPSTR lpCmdLine, int nCmdShow)
- {
- TTestApp TestApp("Dialog Tester", hInstance, hPrevInstance,
- lpCmdLine, nCmdShow);
- TestApp.Run();
- return (TestApp.Status);
- }
-